function selectAll(e) {
  var checklist = document.getElementsByClassName('checkbox-data');
  if (e.checked) {
    for (var i = 0; i < checklist.length; i++) {
      checklist[i].checked = 1;
    }
  } else {
    for (var j = 0; j < checklist.length; j++) {
      checklist[j].checked = 0;
    }
  }

  var checkToggle = document.getElementsByClassName('checkbox-toggle');
  for (var m = 0; m < checkToggle.length; m++) {
    checkToggle[m].checked = e.checked ? 1 : 0;
  }
}

function checkAll() {
  var checklist = document.getElementsByClassName('checkbox-data');
  var selectAll = true;
  for (var i = 0; i < checklist.length; i++) {
    if (checklist[i].checked !== true) {
      selectAll = false;
      break;
    }
  }

  var checkToggle = document.getElementsByClassName('checkbox-toggle');
  for (var j = 0; j < checkToggle.length; j++) {
    checkToggle[j].checked = selectAll ? 1 : 0;
  }
}

/* 公告滚动 */
var t;
$(".news").hover(function(){
  clearInterval(t);
},function(){
  t = setInterval(function(){
    var ul = $(".news-list");
    var liHeight = ul.find("li:last").height();
    ul.animate({marginTop : liHeight +"px"},1000,function(){
      ul.find("li:last").prependTo(ul);
      ul.find("li:first").hide();
      ul.css({marginTop:0});
      ul.find("li:first").fadeIn(300);
    });
  },3000);
}).trigger("mouseleave");

